package com.markerhub.common.enums;

/**
 * @description:
 * @projectName: vueadmin-java
 * @author: zhouhaizhi
 * @createTime: 2021/9/23 14:16
 * @version:1.0
 */
public enum ComEnums {

    DISABLE(0,"禁用"),
    ENABLE(1, "启用");

    private Integer code;

    private String name;

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    ComEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ComEnums getComEnumsByCode(Integer code) {
        ComEnums[] arr = ComEnums.values();
        for (ComEnums comEnums : arr) {
            if (comEnums.getCode().equals(code)) {
                return comEnums;
            }
        }
        return null;
    }

    public static String getNameByCode(Integer code){
        ComEnums comEnums = getComEnumsByCode(code);
        if (null != comEnums) {
            return comEnums.getName();
        }
        return null;
    }
}
